package slerp;

public class Trigger extends Member {
    String name;
    double x, y, radius;
    int id;
    static int counter = 0;
    
    public Trigger(double x, double y, double radius) {
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.id = counter++;
    }

    public Trigger(String name, double x, double y, double radius) {
        this(x, y, radius);
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if(o instanceof Trigger) {
            if (o.hashCode() == this.hashCode()) {
                return true;
            }
        }
        return false;
    }
    
    boolean checkTrigger() {
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.name != null ? this.name.hashCode() : 0);
        hash = 67 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
        hash = 67 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
        hash = 67 * hash + (int) (Double.doubleToLongBits(this.radius) ^ (Double.doubleToLongBits(this.radius) >>> 32));
        hash = 67 * hash + this.id;
        return hash;
    }
    
    @Override
    public String toString() {
        String out = null;
        if(name != null) {
            out += name + ", ";
        }
        return out + id + ", co-ord: " + x + ", " + y + ", Trigger radius" + radius;
    }
}
